-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: functions documented with examples #226
base: main
Are you sure you want to change the base?
docs: functions documented with examples #226
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
* `dispatch_http_call()` * `on_http_call_response()`` * `on_vm_start()` * `get_vm_configuration()` * `on_configure()` * `get_plugin_configuration()` * `set_tick_period()` * `on_tick()` * `on_http_request_headers()` * `get_http_request_headers()` * `get_http_request_header()` * `add_http_request_header()` * `resume_http_context()` * `send_http_response()` Signed-off-by: Anton Engelhardt <[email protected]>
ec2927d
to
d8b90e6
Compare
Signed-off-by: Anton Engelhardt <[email protected]>
4e79be6
to
03514d9
Compare
All examples do not include the |
@PiotrSikora What do you think? Sorry to ping you, but I think this would be a great benefit for DX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PiotrSikora What do you think? Sorry to ping you, but I think this would be a great benefit for DX
I agree those would be very helpful. Sorry for the delay, I'll review this in the coming days.
… stuff Signed-off-by: Anton Engelhardt <[email protected]>
@PiotrSikora I tested all documented functions again and set up a repo with 7 folders that cover all functions. It might still be that something is missing. I will do some diffs on the docs and the testing-repo-files to see if anything is missing apart from the boilerplate stuff ( I hope this makes the review as easy as possible. |
Signed-off-by: Anton Engelhardt <[email protected]>
Signed-off-by: Anton Engelhardt <[email protected]>
3ea0a4d
to
c11460b
Compare
I can squash my changes into one commit, if required. |
@PiotrSikora I can also add the examples from the mentioned repo to the |
Signed-off-by: Anton Engelhardt <[email protected]>
Signed-off-by: Anton Engelhardt <[email protected]>
src/traits.rs
Outdated
/// * `OK` on success. | ||
/// * `BAD_ARGUMENT` for unknown upstream, or when headers are missing required `:authority`, `:method` and/or `:path` values. | ||
/// * `INTERNAL_FAILURE' when the host failed to send requested HTTP call. | ||
/// * `INVALID_MEMORY_ACCESS` when `upstream_data`, `upstream_size`, `headers_data`, `headers_size`, `body_data`, `body_size`, `trailers_data`, `trailers_size` and/or `return_call_id` point to invalid memory address. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks that you've copied those return values from the spec, which is generally fine... However, this SDK:
- combines
*_size
and*_data
into vectors and strings, - assumes that the memory objects are correct, so
INVALID_MEMORY_ACCESS
cannot happen and if it does, then it will result inpanic
, - it's opinionated about which return values are allowed, so if you want to document them, then take a look at
src/hostcalls.rs
and see which return values are there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the docs from the spec and wrote something myself. Is that better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mean that including text from the (now merged) spec is wrong. I meant that it had to be adjusted to account for the higher-level types used in the SDK.
I'll take a look at it in the next few days, thanks!
I took a look at them, and they seem to be mostly duplicates of the existing examples. |
Signed-off-by: Anton Engelhardt <[email protected]>
Signed-off-by: Anton Engelhardt <[email protected]>
Signed-off-by: Anton Engelhardt <[email protected]>
src/traits.rs
Outdated
/// * `OK` on success. | ||
/// * `BAD_ARGUMENT` for unknown upstream, or when headers are missing required `:authority`, `:method` and/or `:path` values. | ||
/// * `INTERNAL_FAILURE' when the host failed to send requested HTTP call. | ||
/// * `INVALID_MEMORY_ACCESS` when `upstream_data`, `upstream_size`, `headers_data`, `headers_size`, `body_data`, `body_size`, `trailers_data`, `trailers_size` and/or `return_call_id` point to invalid memory address. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mean that including text from the (now merged) spec is wrong. I meant that it had to be adjusted to account for the higher-level types used in the SDK.
I'll take a look at it in the next few days, thanks!
/// } | ||
/// } | ||
/// | ||
/// # impl Context for MyRootContext {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if the Context
-implementations, which are needed for the successful compilation, should be shown or hidden in the examples. @PiotrSikora
001b7d3
to
f151f22
Compare
Signed-off-by: Anton Engelhardt <[email protected]>
f151f22
to
3b0cf7e
Compare
Signed-off-by: Anton Engelhardt <[email protected]>
c905b28
to
bf22086
Compare
@PiotrSikora Can you please let the CI checks run so that i can see if it works? |
@PiotrSikora Ok, so the Doc Test CI looks fine, but i dont know why the bazel job is failing. Thanks for running the CI ✌🏻 |
You've added new dependencies, so you need to tell Bazel about them. See |
Signed-off-by: Anton Engelhardt <[email protected]>
Signed-off-by: Anton Engelhardt <[email protected]>
@PiotrSikora Can you please run them again? |
In-Code Documentation for the following functions:
RootContext:
on_vm_start()
get_vm_configuration()
on_configure()
get_plugin_configuration()
set_tick_period()
on_tick()
Context:
dispatch_http_call()
on_http_call_response()
get_http_call_response_headers()
get_http_call_response_headers_bytes()
get_http_call_response_header()
get_http_call_response_header_bytes()
get_http_call_response_body()
get_http_call_response_trailers()
get_http_call_response_trailers_bytes()
get_http_call_response_trailer()
get_http_call_response_trailer_bytes()
HttpContext:
on_http_request_headers()
get_http_request_headers()
get_http_request_headers_bytes()
get_http_request_header()
get_http_request_header_bytes()
add_http_request_header()
send_http_response()
Inspired by proxy-wasm/spec#42
Why?
To have documentation in your editor: